/**
 * Copyright (C) 2024-2030 Super BilGen & 超亿时代信息技术股份有限公司.All Rights Reserved.
 */
package cn.com.yang.uuid;

import com.github.f4b6a3.ulid.Ulid;
import com.github.f4b6a3.ulid.UlidCreator;

/**
 * @Model cn.com.yang.uuid.UlidExample
 * @Desc  TODO
 * @author yangyijin
 * @since 2025年9月28日-上午9:54:18
 */
public class UlidExample {
	public static void main(String[] args) {
		Ulid ulid = UlidCreator.getUlid();
		System.out.println("ULID："+ulid);
		 // 获取字符串形式
        String ulidString = ulid.toString();
        System.out.println("String: " + ulidString);
        
        // 获取时间戳部分
		long timesatmp = ulid.getInstant().toEpochMilli();
		System.out.println("ULID timesatmp："+timesatmp);
		
		 // 从字符串解析 ULID
        Ulid parsedUlid = Ulid.from(ulidString);
        System.out.println("Parsed: " + parsedUlid);
        
        // 生成单调递增的 ULID (适用于高并发场景)
        Ulid monotonicUlid = UlidCreator.getMonotonicUlid();
        System.out.println("Monotonic ULID: " + monotonicUlid);
	}
}
